package com.zyh.map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @Author zyh
 * @Date 2024/8/1 11:00
 * @Description 双列集合Map
 */

public class MapDemo1 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("cxk", "篮球");
        map.put("dz", "悦刻5");
        map.put("giegie", "鸡");
        map.put("牢大", "飞机");
        System.out.println("map = " + map);
        map.put("牢大", "凌晨的洛杉矶");
        System.out.println("map = " + map);
        String remove = map.remove("牢大");
        System.out.println("remove = " + remove);
        System.out.println("map = " + map);
        String cxk = map.get("cxk");
        System.out.println("cxk = " + cxk);
        System.out.println("map = " + map);
        boolean cxk1 = map.containsKey("cxk");
        System.out.println("cxk1 = " + cxk1);
        System.out.println("map = " + map);
        boolean b = map.containsValue("飞机");
        System.out.println("b = " + b);
        System.out.println("map = " + map);
        Set<String> strings = map.keySet();
        strings.forEach(item -> System.out.println(item));
        Collection<String> values = map.values();
        values.forEach(item -> System.out.println(item));
        map.clear();
        System.out.println("map = " + map);
        boolean empty = map.isEmpty();
        System.out.println("empty = " + empty);
        System.out.println("map = " + map);
        int size = map.size();
        System.out.println("size = " + size);

    }
}
